package experiment;

/**
 * @Author:云尚
 * @Description:
 */
import java.util.Scanner;
public class Demo7 {
    public static int Factorial(int n){
        if (n == 0){
            return 1;
        }else {
            return n*Factorial(n-1);
        }
    }

    public static void main(String[] args) {
        //使用递归算法计算n的阶乘
        Scanner input = new Scanner(System.in);
        System.out.println("请输入n的值：");
        int n = input.nextInt();
        int i = Factorial(n);
        System.out.println(i);
    }
}


